<template>
  <div class="rental">
    <div class="container-1200 container">
      <!-- <el-tabs v-model="cate_id">
        <el-tab-pane
          v-for="item in tabsList"
          :label="item.name"
          :name="item.id"
          :key="item.id"
        ></el-tab-pane>
      </el-tabs> -->
      <RentalList :type="type" :rentalList="list" :cate_id="cate_id" />
    </div>
  </div>
</template>

<script>
import RentalList from '@/components/RentalList'
import { mapGetters } from 'vuex'
import { getApiPutHouseList, getApiEntrustList } from '@/api'
export default {
  components: {
    RentalList,
  },
  data() {
    return {
      tabsList: [
        { id: '1', name: '写字楼' },
        { id: '3', name: '厂房' },
        { id: '4', name: '共享办公' },
      ],
      cate_id: '1',
      list: [],
      type: '',
    }
  },
  computed: {
    ...mapGetters(['_userInfo']),
  },
  created() {
    const type = this.$route.params.type
    this.type = type
    const id = localStorage.getItem('id')
    console.log('type: ', type)
    switch (type) {
      case 'put':
        getApiPutHouseList({
          user_id: id,
          page_size: 99,
          page_number: 1,
        }).then((res) => {
          if (res.code === 200) {
            this.list = res.data.list
          } else {
            this.list = []
          }
        })
        break
      case 'entrust':
        getApiEntrustList({
          user_id: id,
          page_size: 99,
          page_number: 1,
        }).then((res) => {
          if (res.code === 200) {
            this.list = res.data.list
          } else {
            this.list = []
          }
        })
        break
    }
  },
  methods: {},
}
</script>

<style lang="less" scoped>
/deep/ .el-tabs__active-bar {
  background-color: #0a68a2;
}
/deep/ .el-tabs__item.is-active {
  color: #0a68a2;
}
/deep/ .el-tabs__item:hover {
  color: #0a68a2;
}
.container {
  padding: 24px 0;
}
</style>
